package com.nbsaas.boot.marketing.rest.resource;

import com.nbsaas.boot.marketing.api.apis.FlashSaleProductApi;
import com.nbsaas.boot.marketing.data.entity.FlashSaleProduct;
import com.nbsaas.boot.marketing.api.domain.request.FlashSaleProductRequest;
import com.nbsaas.boot.marketing.api.domain.response.FlashSaleProductResponse;
import com.nbsaas.boot.marketing.api.domain.simple.FlashSaleProductSimple;
import com.nbsaas.boot.marketing.rest.convert.FlashSaleProductSimpleConvert;
import com.nbsaas.boot.marketing.rest.convert.FlashSaleProductEntityConvert;
import com.nbsaas.boot.marketing.rest.convert.FlashSaleProductResponseConvert;
import com.nbsaas.boot.marketing.data.repository.FlashSaleProductRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   秒杀商品-业务接口实现
*/
@Transactional
@Service
public class FlashSaleProductResource extends BaseResource<FlashSaleProduct,FlashSaleProductResponse, FlashSaleProductSimple, FlashSaleProductRequest>  implements FlashSaleProductApi {

    @Resource
    private FlashSaleProductRepository flashSaleProductRepository;

    @Override
    public JpaRepositoryImplementation<FlashSaleProduct, Serializable> getJpaRepository() {
        return flashSaleProductRepository;
    }

    @Override
    public Function<FlashSaleProduct, FlashSaleProductSimple> getConvertSimple() {
        return new FlashSaleProductSimpleConvert();
    }

    @Override
    public Function<FlashSaleProductRequest, FlashSaleProduct> getConvertForm() {
        return new FlashSaleProductEntityConvert();
    }

    @Override
    public Function<FlashSaleProduct, FlashSaleProductResponse> getConvertResponse() {
        return new FlashSaleProductResponseConvert();
    }




}


